\testfile{pgfplotstest.file.tex}
{%
\testsection{`plot file' test}
\testsubsection{A file in gnuplot format 'num num i'}
%\lstinputlisting{plotdata/pgfplotstest_plot2.gnuplot}
\starttikzpicture
\startaxis
\addplot plot file{plotdata/pgfplotstest_plot2.gnuplot};
\stopaxis
\stoptikzpicture

\testsubsubsection{Same file loaded with `plot table'}
\starttikzpicture
\startaxis
\addplot plot table{plotdata/pgfplotstest_plot2.gnuplot};
\stopaxis
\stoptikzpicture


\testsubsection{A file which differs slightly from gnuplot format}
%\lstinputlisting{plotdata/pgfplotstest_plot4}
\starttikzpicture
\startaxis
\addplot plot file{plotdata/pgfplotstest_plot4.dat};
\stopaxis
\stoptikzpicture

\testsubsection{A file which starts with newlines}
%\lstinputlisting{plotdata/pgfplotstest_plot5}
\starttikzpicture
\startaxis
\addplot plot file{plotdata/pgfplotstest_plot5.dat};
\stopaxis
\stoptikzpicture

\testsubsubsection{Same file loaded with `plot table'}
The first data point should have been identified as column name.

\starttikzpicture
\startaxis
\addplot plot table{plotdata/pgfplotstest_plot5.dat};
\stopaxis
\stoptikzpicture

\testsubsubsection{testing space gobbling in 'plot file' command}
\starttikzpicture
\startaxis
\addplot plot file {plotdata/pgfplotstest_plot2.gnuplot};
\stopaxis
\stoptikzpicture

\testsection{`plot table' test}
%\lstinputlisting{plotdata/pgfplotstest_plot}
\testsubsection{Plot by column `dof' versus column `Lmax'}
\starttikzpicture
\startloglogaxis[xlabel=Dof,ylabel=$L_\infty$ error,title=Read from file `pgfplotstest\_plot']
\addplot plot table[x=dof,y=Lmax] {plotdata/pgfplotstest_plot.dat};
\stoploglogaxis
\stoptikzpicture

\testsubsection{Plot by column 2 versus column 3}
\starttikzpicture
\startloglogaxis[
	xlabel=Dof,
	ylabel=$L_2$ error,
	title=Read from file `pgfplotstest\_plot'
]
\addplot plot table[x index=2,y index=3]{plotdata/pgfplotstest_plot.dat};

\stoploglogaxis
\stoptikzpicture

\testsubsection{Plot by preloaded tables}
{
%\lstinputlisting{plotdata/pgfplotstest_plot3}
\pgfnumtableread{plotdata/pgfplotstest_plot.dat} to \tableA
\pgfnumtableread{plotdata/pgfplotstest_plot3.dat} to \tableB
\starttikzpicture
\startloglogaxis[
	xlabel=Dof,
	ylabel=$L_2$ error,
	title=Read from file `pgfplotstest\_plot' and `pgfplotstest\_plot3'
]
	\addplot plot table[x=dof,y=L2] from \tableA;
	\addplot plot table[x=dof,y=L2] from \tableB;
	\legend{$d=2$\\$d=3$\\}
\stoploglogaxis
\stoptikzpicture
}

\testsubsection{a table which has no column names}
%\lstinputlisting{plotdata/pgfplotstest_plotnocolnames}
\starttikzpicture
\startloglogaxis[
	xlabel=Dof,
	ylabel=$L_2$ error,
	title=Read from file `pgfplotstest\_plotnocolnames'
]
\addplot plot table[x index=2,y index=3]{plotdata/pgfplotstest_plotnocolnames.dat};

\stoploglogaxis
\stoptikzpicture

}
